<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/client/backgroundManagement/commons/global.jsp" %>

<script>
	$('#projectRTypeEditForm').form({
	    url : '${path }/ProjectRTypeDetailController/edit',
	    onSubmit : function() {
	        progressLoad();
	        var isValid = $(this).form('validate');
	        if (!isValid) {
	            progressClose();
	        } 
	        /**
	        	        debugger;
	        var old = $("[name='oldProjectType']")[0].value;
	        var now = $("[name='projectType']")[0].value;
	         if(old!='undefined' && old!=now){
	        	 $.messager.confirm("确认", "类型已更改,确认提交?", function (r) {  
	 	            if (r) {  
	 	                return true;  
	 	            }  
	 	        });  
	         }else{
	        	 return isValid;
	         }
	        */

	         
	        
	        return isValid;
	    },
	    success : function(result) {
	        progressClose();
	        result = $.parseJSON(result);
	        if (result.success) {
	            parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
	            parent.$.modalDialog.handler.dialog('close');
	        } else {
	            parent.$.messager.alert('错误', result.msg, 'error');
	        }
	    }
	});

    var entity ='<%= request.getAttribute("entity")%>';
    entity= $.parseJSON(entity);
   debugger;
    $("[name='name']")[0].value =entity['XMMC'];
   // $("[name='projectType']")[0].value =entity['PROJECT_TYPE_ID'];
    if(entity['PROJECT_START_TIME']!='undefined' && entity['PROJECT_START_TIME']!=undefined){
    	$("[name='projectStartTime']")[0].value = entity['PROJECT_START_TIME'];
    }
    
    if(entity['PROJECT_PLAN_PAY_MONEY']!='undefined' && entity['PROJECT_PLAN_PAY_MONEY']!=undefined){
    	$("[name='projectPlanPayMoney']")[0].value =entity['PROJECT_PLAN_PAY_MONEY'];
    }
    
    
    
    //$("[name='remark']")[0].value =entity['REMARK'];
    
    //
    if(entity['ID']!='undefined' && entity['ID']!=undefined){
    	$("[name='id']")[0].value =entity['ID'];
    }
     
     $("[name='projectId']")[0].value =entity['PKUUID'];
     $("[name='oldProjectType']")[0].value = entity['PROJECT_TYPE_ID']
     $("[name='oldProjectStartTime']")[0].value =entity['PROJECT_START_TIME'];
    
	
	//所属类型
    $('#projectType').combotree({
        url : '${path }/projectTypeController/tree',
        parentField : 'pid',
        lines : true,
        value : entity['PROJECT_TYPE_ID']
    });
	
	//启动日期
//	$('#projectStartTime').datebox('setValue', '2012-02-05');
	
  
 
</script>

 
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="projectRTypeEditForm" method="post">
            <table class="grid">
 
 	            <tr>
                    <td>项目名称</td>
                    <td>
                   	    <input name="id" type="hidden" descript = "ID" >
	                    <input name="projectId" type="hidden" descript = "项目ID" >
	                    <input name="oldProjectType" type="hidden" descript = "原项目类型ID" >
	                    <input name="oldProjectStartTime" type="hidden" descript = "原项目启动时间" >
	                  
	                    <input name="name" type="text" placeholder="请输入服务名称" style="width: 230px;" class="easyui-validatebox span2" data-options="required:true"  >
                    </td>
                </tr>
                
               <tr>
                    <td>项目类型</td>
                    <td><select id="projectType" name="projectType" style="width: 235px; height: 29px;" class="easyui-validatebox" data-options="required:true"></select></td>

                </tr>
                
                 <tr>
                    <td>启动时间</td>
                    <td><input  id="projectStartTime" name="projectStartTime" style="width: 240px; height: 29px;" class="easyui-datebox"  data-options="required:true" /></td>

                </tr>
 
                
                 <tr>
                    <td>计划总金额</td>
                    <td  id="projectPlanPayMoney" name="projectPlanPayMoney" style="width: 240px; height: 29px;" class="easyui-textbox" data-options="multiline:true"  /></td>
                </tr>
                
			<!-- 
			
			                <tr>
                  <td>备注</td>
                 <td><textarea name="remark"  rows="" cols="" style="width: 350px;height: 50px" id="remark"></textarea></td>
                </tr>
			
			
			 -->
            </table>
            
        </form>
    </div>
</div>